/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nutmotion.service;

import com.nutmotion.common.Constants;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author Manu
 */
public class MainService {
    
    
    private EntityManager createEntityManager() {
        EntityManagerFactory emf=Persistence.createEntityManagerFactory("tradeUplanPU");
        EntityManager em=emf.createEntityManager();
        return em;
    }        
    
    protected String constructsJPQLWhereClause(String pathToEntityField, Object valueForField) {
        if (valueForField != null)
            return pathToEntityField + Constants.JPQL_WHERE_CLAUSE_EQUALITY + valueForField;
        else
            return null;
    }
    
//    public Stock findById(int id) {
//        return (Stock)EMF.createEntityManager().find(Stock.class, id);
//    }
}
